\(\int \frac {a+b x+c x^2}{(d+e x)^2 \sqrt {f+g x}} \, dx\) [824]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F(-1)]
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 27, antiderivative size = 140 \[ \int \frac {a+b x+c x^2}{(d+e x)^2 \sqrt {f+g x}} \, dx=\frac {2 c \sqrt {f+g x}}{e^2 g}-\frac {\left (a+\frac {d (c d-b e)}{e^2}\right ) \sqrt {f+g x}}{(e f-d g) (d+e x)}+\frac {(c d (4 e f-3 d g)-e (2 b e f-b d g-a e g)) \text {arctanh}\left (\frac {\sqrt {e} \sqrt {f+g x}}{\sqrt {e f-d g}}\right )}{e^{5/2} (e f-d g)^{3/2}} \]

[Out]

(c*d*(-3*d*g+4*e*f)-e*(-a*e*g-b*d*g+2*b*e*f))*arctanh(e^(1/2)*(g*x+f)^(1/2)/(-d*g+e*f)^(1/2))/e^(5/2)/(-d*g+e*
f)^(3/2)+2*c*(g*x+f)^(1/2)/e^2/g-(a+d*(-b*e+c*d)/e^2)*(g*x+f)^(1/2)/(-d*g+e*f)/(e*x+d)

Rubi [A] (verified)

Time = 0.17 (sec) , antiderivative size = 144, normalized size of antiderivative = 1.03, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.148, Rules used = {911, 1171, 396, 214} \[ \int \frac {a+b x+c x^2}{(d+e x)^2 \sqrt {f+g x}} \, dx=\frac {\text {arctanh}\left (\frac {\sqrt {e} \sqrt {f+g x}}{\sqrt {e f-d g}}\right ) (c d (4 e f-3 d g)-e (-a e g-b d g+2 b e f))}{e^{5/2} (e f-d g)^{3/2}}-\frac {\sqrt {f+g x} \left (a e^2-b d e+c d^2\right )}{e^2 (d+e x) (e f-d g)}+\frac {2 c \sqrt {f+g x}}{e^2 g} \]

[In]

Int[(a + b*x + c*x^2)/((d + e*x)^2*Sqrt[f + g*x]),x]

[Out]

(2*c*Sqrt[f + g*x])/(e^2*g) - ((c*d^2 - b*d*e + a*e^2)*Sqrt[f + g*x])/(e^2*(e*f - d*g)*(d + e*x)) + ((c*d*(4*e
*f - 3*d*g) - e*(2*b*e*f - b*d*g - a*e*g))*ArcTanh[(Sqrt[e]*Sqrt[f + g*x])/Sqrt[e*f - d*g]])/(e^(5/2)*(e*f - d
*g)^(3/2))

Rule 214

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x/Rt[-a/b, 2]], x] /; FreeQ[{a, b},
x] && NegQ[a/b]

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rule 911

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))^(n_)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :
> With[{q = Denominator[m]}, Dist[q/e, Subst[Int[x^(q*(m + 1) - 1)*((e*f - d*g)/e + g*(x^q/e))^n*((c*d^2 - b*d
*e + a*e^2)/e^2 - (2*c*d - b*e)*(x^q/e^2) + c*(x^(2*q)/e^2))^p, x], x, (d + e*x)^(1/q)], x]] /; FreeQ[{a, b, c
, d, e, f, g}, x] && NeQ[e*f - d*g, 0] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0] && IntegersQ[n,
 p] && FractionQ[m]

Rule 1171

Int[((d_) + (e_.)*(x_)^2)^(q_)*((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4)^(p_.), x_Symbol] :> With[{Qx = PolynomialQ
uotient[(a + b*x^2 + c*x^4)^p, d + e*x^2, x], R = Coeff[PolynomialRemainder[(a + b*x^2 + c*x^4)^p, d + e*x^2,
x], x, 0]}, Simp[(-R)*x*((d + e*x^2)^(q + 1)/(2*d*(q + 1))), x] + Dist[1/(2*d*(q + 1)), Int[(d + e*x^2)^(q + 1
)*ExpandToSum[2*d*(q + 1)*Qx + R*(2*q + 3), x], x], x]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] &&
 NeQ[c*d^2 - b*d*e + a*e^2, 0] && IGtQ[p, 0] && LtQ[q, -1]

Rubi steps \begin{align*} \text {integral}& = \frac {2 \text {Subst}\left (\int \frac {\frac {c f^2-b f g+a g^2}{g^2}-\frac {(2 c f-b g) x^2}{g^2}+\frac {c x^4}{g^2}}{\left (\frac {-e f+d g}{g}+\frac {e x^2}{g}\right )^2} \, dx,x,\sqrt {f+g x}\right )}{g} \\ & = -\frac {\left (c d^2-b d e+a e^2\right ) \sqrt {f+g x}}{e^2 (e f-d g) (d+e x)}+\frac {\text {Subst}\left (\int \frac {-a+\frac {c d^2}{e^2}-\frac {b d}{e}-\frac {2 c f^2}{g^2}+\frac {2 b f}{g}+\frac {2 c (e f-d g) x^2}{e g^2}}{\frac {-e f+d g}{g}+\frac {e x^2}{g}} \, dx,x,\sqrt {f+g x}\right )}{e f-d g} \\ & = \frac {2 c \sqrt {f+g x}}{e^2 g}-\frac {\left (c d^2-b d e+a e^2\right ) \sqrt {f+g x}}{e^2 (e f-d g) (d+e x)}-\frac {(c d (4 e f-3 d g)-e (2 b e f-b d g-a e g)) \text {Subst}\left (\int \frac {1}{\frac {-e f+d g}{g}+\frac {e x^2}{g}} \, dx,x,\sqrt {f+g x}\right )}{e^2 g (e f-d g)} \\ & = \frac {2 c \sqrt {f+g x}}{e^2 g}-\frac {\left (c d^2-b d e+a e^2\right ) \sqrt {f+g x}}{e^2 (e f-d g) (d+e x)}+\frac {(c d (4 e f-3 d g)-e (2 b e f-b d g-a e g)) \tanh ^{-1}\left (\frac {\sqrt {e} \sqrt {f+g x}}{\sqrt {e f-d g}}\right )}{e^{5/2} (e f-d g)^{3/2}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.43 (sec) , antiderivative size = 150, normalized size of antiderivative = 1.07 \[ \int \frac {a+b x+c x^2}{(d+e x)^2 \sqrt {f+g x}} \, dx=\frac {\sqrt {f+g x} \left (e (b d-a e) g+c \left (-3 d^2 g+2 e^2 f x+2 d e (f-g x)\right )\right )}{e^2 g (e f-d g) (d+e x)}-\frac {(c d (-4 e f+3 d g)+e (2 b e f-b d g-a e g)) \arctan \left (\frac {\sqrt {e} \sqrt {f+g x}}{\sqrt {-e f+d g}}\right )}{e^{5/2} (-e f+d g)^{3/2}} \]

[In]

Integrate[(a + b*x + c*x^2)/((d + e*x)^2*Sqrt[f + g*x]),x]

[Out]

(Sqrt[f + g*x]*(e*(b*d - a*e)*g + c*(-3*d^2*g + 2*e^2*f*x + 2*d*e*(f - g*x))))/(e^2*g*(e*f - d*g)*(d + e*x)) -
 ((c*d*(-4*e*f + 3*d*g) + e*(2*b*e*f - b*d*g - a*e*g))*ArcTan[(Sqrt[e]*Sqrt[f + g*x])/Sqrt[-(e*f) + d*g]])/(e^
(5/2)*(-(e*f) + d*g)^(3/2))

Maple [A] (verified)

Time = 0.55 (sec) , antiderivative size = 152, normalized size of antiderivative = 1.09

method result size
risch \(\frac {2 c \sqrt {g x +f}}{e^{2} g}+\frac {\frac {g \left (e^{2} a -b d e +c \,d^{2}\right ) \sqrt {g x +f}}{\left (d g -e f \right ) \left (e \left (g x +f \right )+d g -e f \right )}+\frac {\left (a \,e^{2} g +b d e g -2 b \,e^{2} f -3 c \,d^{2} g +4 c d e f \right ) \arctan \left (\frac {e \sqrt {g x +f}}{\sqrt {\left (d g -e f \right ) e}}\right )}{\left (d g -e f \right ) \sqrt {\left (d g -e f \right ) e}}}{e^{2}}\) \(152\)
derivativedivides \(\frac {\frac {2 c \sqrt {g x +f}}{e^{2}}+\frac {2 g \left (\frac {g \left (e^{2} a -b d e +c \,d^{2}\right ) \sqrt {g x +f}}{2 \left (d g -e f \right ) \left (e \left (g x +f \right )+d g -e f \right )}+\frac {\left (a \,e^{2} g +b d e g -2 b \,e^{2} f -3 c \,d^{2} g +4 c d e f \right ) \arctan \left (\frac {e \sqrt {g x +f}}{\sqrt {\left (d g -e f \right ) e}}\right )}{2 \left (d g -e f \right ) \sqrt {\left (d g -e f \right ) e}}\right )}{e^{2}}}{g}\) \(156\)
default \(\frac {\frac {2 c \sqrt {g x +f}}{e^{2}}+\frac {2 g \left (\frac {g \left (e^{2} a -b d e +c \,d^{2}\right ) \sqrt {g x +f}}{2 \left (d g -e f \right ) \left (e \left (g x +f \right )+d g -e f \right )}+\frac {\left (a \,e^{2} g +b d e g -2 b \,e^{2} f -3 c \,d^{2} g +4 c d e f \right ) \arctan \left (\frac {e \sqrt {g x +f}}{\sqrt {\left (d g -e f \right ) e}}\right )}{2 \left (d g -e f \right ) \sqrt {\left (d g -e f \right ) e}}\right )}{e^{2}}}{g}\) \(156\)
pseudoelliptic \(\frac {\left (e x +d \right ) g \left (\left (a g -2 b f \right ) e^{2}+d \left (b g +4 c f \right ) e -3 c \,d^{2} g \right ) \arctan \left (\frac {e \sqrt {g x +f}}{\sqrt {\left (d g -e f \right ) e}}\right )+\sqrt {g x +f}\, \sqrt {\left (d g -e f \right ) e}\, \left (\left (-2 c f x +a g \right ) e^{2}-d \left (\left (-2 c x +b \right ) g +2 c f \right ) e +3 c \,d^{2} g \right )}{\sqrt {\left (d g -e f \right ) e}\, g \,e^{2} \left (d g -e f \right ) \left (e x +d \right )}\) \(156\)

[In]

int((c*x^2+b*x+a)/(e*x+d)^2/(g*x+f)^(1/2),x,method=_RETURNVERBOSE)

[Out]

2*c*(g*x+f)^(1/2)/e^2/g+1/e^2*(g*(a*e^2-b*d*e+c*d^2)/(d*g-e*f)*(g*x+f)^(1/2)/(e*(g*x+f)+d*g-e*f)+(a*e^2*g+b*d*
e*g-2*b*e^2*f-3*c*d^2*g+4*c*d*e*f)/(d*g-e*f)/((d*g-e*f)*e)^(1/2)*arctan(e*(g*x+f)^(1/2)/((d*g-e*f)*e)^(1/2)))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 312 vs. \(2 (126) = 252\).

Time = 0.49 (sec) , antiderivative size = 637, normalized size of antiderivative = 4.55 \[ \int \frac {a+b x+c x^2}{(d+e x)^2 \sqrt {f+g x}} \, dx=\left [-\frac {\sqrt {e^{2} f - d e g} {\left (2 \, {\left (2 \, c d^{2} e - b d e^{2}\right )} f g - {\left (3 \, c d^{3} - b d^{2} e - a d e^{2}\right )} g^{2} + {\left (2 \, {\left (2 \, c d e^{2} - b e^{3}\right )} f g - {\left (3 \, c d^{2} e - b d e^{2} - a e^{3}\right )} g^{2}\right )} x\right )} \log \left (\frac {e g x + 2 \, e f - d g - 2 \, \sqrt {e^{2} f - d e g} \sqrt {g x + f}}{e x + d}\right ) - 2 \, {\left (2 \, c d e^{3} f^{2} - {\left (5 \, c d^{2} e^{2} - b d e^{3} + a e^{4}\right )} f g + {\left (3 \, c d^{3} e - b d^{2} e^{2} + a d e^{3}\right )} g^{2} + 2 \, {\left (c e^{4} f^{2} - 2 \, c d e^{3} f g + c d^{2} e^{2} g^{2}\right )} x\right )} \sqrt {g x + f}}{2 \, {\left (d e^{5} f^{2} g - 2 \, d^{2} e^{4} f g^{2} + d^{3} e^{3} g^{3} + {\left (e^{6} f^{2} g - 2 \, d e^{5} f g^{2} + d^{2} e^{4} g^{3}\right )} x\right )}}, -\frac {\sqrt {-e^{2} f + d e g} {\left (2 \, {\left (2 \, c d^{2} e - b d e^{2}\right )} f g - {\left (3 \, c d^{3} - b d^{2} e - a d e^{2}\right )} g^{2} + {\left (2 \, {\left (2 \, c d e^{2} - b e^{3}\right )} f g - {\left (3 \, c d^{2} e - b d e^{2} - a e^{3}\right )} g^{2}\right )} x\right )} \arctan \left (\frac {\sqrt {-e^{2} f + d e g} \sqrt {g x + f}}{e g x + e f}\right ) - {\left (2 \, c d e^{3} f^{2} - {\left (5 \, c d^{2} e^{2} - b d e^{3} + a e^{4}\right )} f g + {\left (3 \, c d^{3} e - b d^{2} e^{2} + a d e^{3}\right )} g^{2} + 2 \, {\left (c e^{4} f^{2} - 2 \, c d e^{3} f g + c d^{2} e^{2} g^{2}\right )} x\right )} \sqrt {g x + f}}{d e^{5} f^{2} g - 2 \, d^{2} e^{4} f g^{2} + d^{3} e^{3} g^{3} + {\left (e^{6} f^{2} g - 2 \, d e^{5} f g^{2} + d^{2} e^{4} g^{3}\right )} x}\right ] \]

[In]

integrate((c*x^2+b*x+a)/(e*x+d)^2/(g*x+f)^(1/2),x, algorithm="fricas")

[Out]

[-1/2*(sqrt(e^2*f - d*e*g)*(2*(2*c*d^2*e - b*d*e^2)*f*g - (3*c*d^3 - b*d^2*e - a*d*e^2)*g^2 + (2*(2*c*d*e^2 -
b*e^3)*f*g - (3*c*d^2*e - b*d*e^2 - a*e^3)*g^2)*x)*log((e*g*x + 2*e*f - d*g - 2*sqrt(e^2*f - d*e*g)*sqrt(g*x +
 f))/(e*x + d)) - 2*(2*c*d*e^3*f^2 - (5*c*d^2*e^2 - b*d*e^3 + a*e^4)*f*g + (3*c*d^3*e - b*d^2*e^2 + a*d*e^3)*g
^2 + 2*(c*e^4*f^2 - 2*c*d*e^3*f*g + c*d^2*e^2*g^2)*x)*sqrt(g*x + f))/(d*e^5*f^2*g - 2*d^2*e^4*f*g^2 + d^3*e^3*
g^3 + (e^6*f^2*g - 2*d*e^5*f*g^2 + d^2*e^4*g^3)*x), -(sqrt(-e^2*f + d*e*g)*(2*(2*c*d^2*e - b*d*e^2)*f*g - (3*c
*d^3 - b*d^2*e - a*d*e^2)*g^2 + (2*(2*c*d*e^2 - b*e^3)*f*g - (3*c*d^2*e - b*d*e^2 - a*e^3)*g^2)*x)*arctan(sqrt
(-e^2*f + d*e*g)*sqrt(g*x + f)/(e*g*x + e*f)) - (2*c*d*e^3*f^2 - (5*c*d^2*e^2 - b*d*e^3 + a*e^4)*f*g + (3*c*d^
3*e - b*d^2*e^2 + a*d*e^3)*g^2 + 2*(c*e^4*f^2 - 2*c*d*e^3*f*g + c*d^2*e^2*g^2)*x)*sqrt(g*x + f))/(d*e^5*f^2*g
- 2*d^2*e^4*f*g^2 + d^3*e^3*g^3 + (e^6*f^2*g - 2*d*e^5*f*g^2 + d^2*e^4*g^3)*x)]

Sympy [F(-1)]

Timed out. \[ \int \frac {a+b x+c x^2}{(d+e x)^2 \sqrt {f+g x}} \, dx=\text {Timed out} \]

[In]

integrate((c*x**2+b*x+a)/(e*x+d)**2/(g*x+f)**(1/2),x)

[Out]

Timed out

Maxima [F(-2)]

Exception generated. \[ \int \frac {a+b x+c x^2}{(d+e x)^2 \sqrt {f+g x}} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate((c*x^2+b*x+a)/(e*x+d)^2/(g*x+f)^(1/2),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(e*(d*g-e*f)>0)', see `assume?`
 for more de

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 176, normalized size of antiderivative = 1.26 \[ \int \frac {a+b x+c x^2}{(d+e x)^2 \sqrt {f+g x}} \, dx=-\frac {{\left (4 \, c d e f - 2 \, b e^{2} f - 3 \, c d^{2} g + b d e g + a e^{2} g\right )} \arctan \left (\frac {\sqrt {g x + f} e}{\sqrt {-e^{2} f + d e g}}\right )}{{\left (e^{3} f - d e^{2} g\right )} \sqrt {-e^{2} f + d e g}} - \frac {\sqrt {g x + f} c d^{2} g - \sqrt {g x + f} b d e g + \sqrt {g x + f} a e^{2} g}{{\left (e^{3} f - d e^{2} g\right )} {\left ({\left (g x + f\right )} e - e f + d g\right )}} + \frac {2 \, \sqrt {g x + f} c}{e^{2} g} \]

[In]

integrate((c*x^2+b*x+a)/(e*x+d)^2/(g*x+f)^(1/2),x, algorithm="giac")

[Out]

-(4*c*d*e*f - 2*b*e^2*f - 3*c*d^2*g + b*d*e*g + a*e^2*g)*arctan(sqrt(g*x + f)*e/sqrt(-e^2*f + d*e*g))/((e^3*f
- d*e^2*g)*sqrt(-e^2*f + d*e*g)) - (sqrt(g*x + f)*c*d^2*g - sqrt(g*x + f)*b*d*e*g + sqrt(g*x + f)*a*e^2*g)/((e
^3*f - d*e^2*g)*((g*x + f)*e - e*f + d*g)) + 2*sqrt(g*x + f)*c/(e^2*g)

Mupad [B] (verification not implemented)

Time = 0.25 (sec) , antiderivative size = 146, normalized size of antiderivative = 1.04 \[ \int \frac {a+b x+c x^2}{(d+e x)^2 \sqrt {f+g x}} \, dx=\frac {\mathrm {atan}\left (\frac {\sqrt {e}\,\sqrt {f+g\,x}}{\sqrt {d\,g-e\,f}}\right )\,\left (a\,e^2\,g-2\,b\,e^2\,f-3\,c\,d^2\,g+b\,d\,e\,g+4\,c\,d\,e\,f\right )}{e^{5/2}\,{\left (d\,g-e\,f\right )}^{3/2}}+\frac {\sqrt {f+g\,x}\,\left (c\,g\,d^2-b\,g\,d\,e+a\,g\,e^2\right )}{\left (d\,g-e\,f\right )\,\left (e^3\,\left (f+g\,x\right )-e^3\,f+d\,e^2\,g\right )}+\frac {2\,c\,\sqrt {f+g\,x}}{e^2\,g} \]

[In]

int((a + b*x + c*x^2)/((f + g*x)^(1/2)*(d + e*x)^2),x)

[Out]

(atan((e^(1/2)*(f + g*x)^(1/2))/(d*g - e*f)^(1/2))*(a*e^2*g - 2*b*e^2*f - 3*c*d^2*g + b*d*e*g + 4*c*d*e*f))/(e
^(5/2)*(d*g - e*f)^(3/2)) + ((f + g*x)^(1/2)*(a*e^2*g + c*d^2*g - b*d*e*g))/((d*g - e*f)*(e^3*(f + g*x) - e^3*
f + d*e^2*g)) + (2*c*(f + g*x)^(1/2))/(e^2*g)